<template>
  <div class="member-info">
    <div class="member-info__details">
      <div class="member-info__details--identity">
        <div class="name">
          <section>
            李嘉贤/13625814766
            <slot name="redact"></slot>
          </section>
        </div>
        <div>
          <div>
            <span>注册时间：</span>1985-10-22 14:25:22
          </div>
          <div>
            <span>上级店主：</span>李嘉贤/1367894522
          </div>
          <div>
            <span>上级推荐：</span>刘德华/15036987455
          </div>
          <div>
            <span>上级股东：</span>张三/1367894522
          </div>
          <div>
            <span>所属店铺：</span>罗湖区健康路4号
            <button @click="isMemberTransferShopShow = true">
              修改<span class="iconfont icon-bianji"></span>
            </button>
          </div>
        </div>
        <div>
          <div class="gender">
            <span>性别：</span>
            <div>女</div>
          </div>
          <div>
            <span>出生日期：</span>
            <div>2022-10-12</div>
          </div>
          <div>
            <span>身份证号：</span>
            <div>44128312253685254</div>
          </div>
          <div>
            <span>会员地址：</span>
            <div>广东省 佛山市 南海区 大沥镇 冯边大街什么巷子155号</div>
          </div>
        </div>
      </div>
      <div class="member-info__details--remark">
        <div>会员备注：</div>
        <slot name="postscript"></slot>
      </div>
    </div>
    <div class="member-info__code">
      <div class="member-info__code--left">
        <img :src="prefixOssUrl('member/supreme-icon.png')" />
        <span>{{props.memberInfo.type}}</span>
      </div>
      <div class="member-info__code--right" @click="showInvitationCode = true">
        <div class="r-icon iconfont icon-erweima"></div>
        <div class="r-text">
          <p>邀请码</p>
          DD511242
        </div>
      </div>
    </div>
    <slot name="btn"></slot>
    <div style="display: flex;">
      <slot name="numerical"></slot>
    </div>
  </div>
  <n-modal v-model:show="showInvitationCode" body-style="--n-box-shadow: none;">
    <div class="invitation-code">
      <img :src="prefixOssUrl('member/invitation-code-bg.png')" />
      <div class="invitation-code__content">
        <header>李嘉贤的邀请码</header>
        <img />
        <footer>
          <div>微信扫一扫，快速申请加入</div>
          <div>邀请码: DD511242</div>
        </footer>
        <button>
          复制邀请码
        </button>
      </div>
    </div>
  </n-modal>
  <n-modal v-model:show="isMemberTransferShopShow" class="member-transfer-shop_update" preset="card" :style="{width:'1000px',height:'600px'}" size="huge" :bordered="false">
    <template #header>
      <div class="my-title--modal">所属店铺修改</div>
    </template>
    <div class="content">
      <p class="content_title">选择店铺</p>
      <div class="content_item" :class="{'content_item--active': true}">
        <div class="content_item--active_icon iconfont icon-queding"></div>
        北湖区将康路4号
      </div>
      <div class="content_item">北湖区将康路4号</div>
    </div>
    <template #footer>
      <div class="footer">
        <button class="my-btn--primary">确认修改</button>
      </div>
    </template>
  </n-modal>
</template>

<script setup>
import { ref, inject } from "vue";

let isMemberTransferShopShow = ref(false);
const { prefixOssUrl } = inject('globalMethods');
const showInvitationCode = inject('showInvitationCode');
const props = defineProps(['memberInfo']);
</script>

<style lang="less" scoped>
.member-info {
  height: 91.67vh;

  &__details {
    display: flex;
    justify-content: space-between;

    &--identity {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      padding: 3.7vh 2.86vw 0.677vw 1.61vw;
      width: 100%;
      font-size: 26px;
      color: #4a5060;
      box-sizing: border-box;

      .name {
        margin-bottom: 2.95vh;
        width: 100%;

        > section {
          position: relative;
          width: fit-content;
          font-size: 36px;
          font-weight: bold;
          color: #2e323d;
          line-height: 3.15vh;

          /deep/ .redact {
            position: absolute;
            top: 0;
            right: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 128px;
            height: 44px;
            font-size: 24px;
            font-weight: 400;
            color: #666;
            background: #f8f8f8;
            border: 1px solid #e5e5e5;
            border-radius: 5px;
            transform: translate(120%, -14%);

            span {
              margin-left: 10px;
              font-size: 30px;
            }
          }
        }
      }

      > div {
        > div {
          position: relative;
          display: flex;
          margin-bottom: 1.042vw;
          line-height: 2.31vh;

          span {
            color: #4a5060;
          }

          button {
            position: absolute;
            top: -9px;
            right: -100px;
            display: flex;
            justify-content: center;
            align-items: center;
            width: 128px;
            height: 44px;
            font-size: 24px;
            color: #666;
            background: #f8f8f8;
            border: 1px solid #e5e5e5;
            border-radius: 5px;
            > span {
              margin-left: 5px;
              font-size: 30px;
            }
          }
        }

        .gender {
          > span::before {
            content: "占位";
            opacity: 0;
          }
        }
      }
    }

    &--remark {
      margin: 2.083vw 0 2.56vh;
      padding-right: 1.61vw;
      font-size: 26px;
      box-sizing: border-box;

      > div {
        font-weight: 500;
        color: #4a5060;
        line-height: 36px;
      }

      /deep/ textarea {
        width: 23.75vw;
        height: 9.271vw;
        margin-top: 0.99vw;
        padding: 20px 23px;
        background: #f5f5f5;
        border: 1px solid #e5e5e5;
        border-radius: 0.208vw;
        box-sizing: border-box;
        resize: none;

        &::placeholder {
          font-size: 26px;
          font-weight: 400;
          color: #999;
        }
      }
    }
  }

  &__code {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 1.56vw;
    padding: 0 1.61vw;
    height: 11.11vh;
    background-color: #ccc;
    &--left {
      display: flex;
      align-items: center;
      font-size: 40px;
      font-weight: 500;
      color: #2e323d;
      img {
        width: 48px;
        height: 48px;
        margin-right: 10px;
      }
    }
    &--right {
      display: flex;
      align-items: center;
      .r-icon {
        margin-right: 5px;
        color: #666;
        font-size: 88px;
      }
      .r-text {
        font-size: 28px;
        p {
          font-size: 30px;
          color: #2e323d;
        }
      }
    }
  }

  /deep/ &__btn {
    display: flex;
    justify-content: space-between;
    margin: 1.56vw 1.56vw 0;

    > div:first-child {
      display: flex;

      > label {
        position: relative;
        margin-right: 0.94vw;

        > input {
          position: absolute;
          width: 0;
          height: 0;
          opacity: 0;
        }

        > input + div {
          width: 8.229vw;
          height: 3.125vw;
          font-size: 24px;
          color: #666;
          background: #f8f8f8;
          box-shadow: 0 0 0 1px #e5e5e5;
          border-radius: 0.26vw;
          text-align: center;
          line-height: 3.125vw;
        }

        > input:checked + div {
          color: #fff;
          background: #1981f4;
          box-shadow: none;
        }
      }
    }

    > div:last-child {
      width: 8.229vw;
      height: 3.125vw;
      font-size: 24px;
      color: #fff;
      background: #1981f4;
      border-radius: 0.26vw;
      text-align: center;
      line-height: 3.125vw;
    }
  }

  /deep/ &__particulars {
    margin: 0 0 0 1.56vw;

    &--title {
      display: flex;
      align-items: center;
      width: 100%;
      margin: 1.56vw 0;
      font-size: 28px;
      color: #4a5060;
      line-height: 1;

      &:before {
        content: "";
        display: inline-block;
        margin-right: 0.521vw;
        width: 6px;
        height: 24px;
        background: #373b4f;
      }
    }

    > div:last-child {
      display: flex;

      > .member-info__particulars--body {
        margin-left: 18px;

        > div {
          display: flex;
          flex-direction: column;
          align-items: center;
          padding: 1.042vw 1.25vw 0;
          width: 15vw;
          height: 14.323vw;
          background: #f8f8f8;
          border-radius: 0.521vw;
          box-sizing: border-box;

          > img {
            width: 2.813vw;
            height: 2.813vw;
            background: linear-gradient(0deg, #ff4d5e, #ffb67e);
          }

          .money {
            margin: 1.042vw;
            font-size: 44px;
            font-weight: bold;
            color: #2e323d;
            line-height: 0.81;
          }

          .name {
            margin-bottom: 1.563vw;
            font-size: 26px;
            color: #4a5060;
            line-height: 1;
          }

          .btn,
          .single-btn {
            display: flex;
            justify-content: space-between;
            width: 100%;

            > div {
              width: 3.542vw;
              height: 2.292vw;
              font-size: 26px;
              color: #2c8cf0;
              background: #ebf4ff;
              text-align: center;
              line-height: 2.292vw;
              border-radius: 0.26vw;
              box-shadow: 0 0 0 1px #2c8cf0;
            }

            > div:first-child {
              color: #fe9900;
              background: #fcf4e8;
              box-shadow: 0 0 0 1px #fe9900;
            }
          }

          .single-btn {
            justify-content: center;

            > div:first-child {
              color: #2c8cf0;
              background: #ebf4ff;
              box-shadow: 0 0 0 1px #2c8cf0;
            }
          }
        }
      }

      > .member-info__particulars--body:first-child {
        margin: 0;
      }
    }
  }
}

.invitation-code {
  position: relative;
  line-height: 1;

  > img {
    width: 630px;
    height: 760px;
  }

  &__content {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;

    > header {
      margin: 40px 0 51px;
      font-size: 36px;
      color: #333333;
    }

    > img {
      width: 332px;
      height: 332px;
      background: yellowgreen;
    }

    > footer {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-top: 40px;

      > div:first-child {
        font-size: 26px;
        color: #909399;
      }

      > div:last-child {
        margin-top: 19px;
        font-size: 28px;
        font-weight: bold;
        color: #2e323d;
      }
    }

    > button {
      position: absolute;
      bottom: 60px;
      width: 158px;
      height: 60px;
      font-size: 24px;
      line-height: 60px;
      color: #fff;
      background: #2c8cf0;
      border-radius: 30px;
      text-align: center;
    }
  }
}

.member-transfer-shop_update {
  .content {
    height: 350px;
    overflow-y: auto;
    &_title {
      margin-bottom: 30px;
      font-size: 26px;
      font-weight: 500;
      color: #4a5060;
    }
    &_item {
      width: 870px;
      height: 90px;
      padding: 0 20px;
      margin-bottom: 30px;
      font-size: 30px;
      font-weight: 500;
      color: #999;
      line-height: 90px;
      background: #f8f8f8;
      border: 1px solid #e5e5e5;
      border-radius: 5px;
      &--active {
        position: relative;
        color: #1981f4;
        background: #e6f2ff;
        border: 1px solid #1981f4;
        &::after {
          position: absolute;
          top: 0;
          right: 0;
          content: "";
          width: 0;
          height: 0;
          border-top: 30px solid #1981f4;
          border-left: 30px solid transparent;
        }

        &_icon {
          position: absolute;
          top: -38px;
          right: 0;
          z-index: 99;
          font-size: 18px;
          color: #fff;
        }
      }
    }
  }
  .footer {
    display: flex;
    justify-content: flex-end;
  }
}
</style>